package cmd.commands;

import platform.PlatformObjectFactory;
import platform.upgrader.PlayerUpgrader;
import util.PlayerUtilities;

public class UpgradePlayerCommand extends Command {
	public UpgradePlayerCommand(Command c) {
		super(c.command, c.parameters);
	}

	@Override
	public boolean execute() {
		PlayerUpgrader upgrader = PlatformObjectFactory.getInstance().getPlayerUpgrader();
		if(this.parameters==null || this.parameters.length==0) {
			upgrader.update(null);
		} else {
			upgrader.update(this.parameters[0]);
		}
		PlayerUtilities.saveJsonToFile("UPGRADE_PLAYER",0);
		return true;
	}
}
